"""
工具函数包
提供各种通用工具和辅助函数
"""
from app.utils.helpers import (
    generate_user_id,
    format_timestamp,
    sanitize_html,
    validate_email,
    validate_username,
    get_file_extension,
    is_allowed_file,
    generate_filename,
    paginate_query,
    truncate_text,
    generate_random_string,
    get_client_ip,
    format_file_size,
    parse_bool,
    safe_int,
    safe_str,
    pluck,
    group_by,
    relative_time,
    is_safe_url,
    generate_gravatar_url,
    format_number,
    humanize_list,
    get_current_year,
    generate_breadcrumbs,
    calculate_read_time,
    generate_excerpt
)

from app.utils.validators import (
    PasswordValidator,
    UsernameValidator,
    EmailValidator,
    ContentValidator,
    FileValidator
)

from app.utils.exceptions import (
    SteHubException,
    ValidationError,
    AuthenticationError,
    AuthorizationError,
    ResourceNotFoundError,
    StorageError,
    APIError,
    DatabaseError,
    NetworkError,
    ConfigurationError,
    RateLimitError,
    FileUploadError,
    EmailError,
    ChatError,
    ForumError,
    RealTimeError,
    ThirdPartyServiceError,
    handle_exception,
    create_validation_error,
    create_resource_not_found
)

from app.utils.logging import (
    setup_logging,
    get_logger,
    log_request,
    log_response,
    log_error,
    log_security_event,
    log_user_activity,
    log_database_operation,
    log_performance_metric,
    log_decorator
)

from app.utils.cache import (
    cache_get,
    cache_set,
    cache_delete,
    cache_clear,
    cache_get_or_set,
    cache_memoize,
    rate_limit,
    rate_limit_decorator,
    get_cache_stats,
    cache_cleanup,
    generate_cache_key,
    cache_invalidate
)

from app.utils.email import (
    send_email,
    send_welcome_email,
    send_password_reset_email,
    send_notification_email,
    send_verification_email,
    send_admin_notification,
    validate_email_format,
    send_bulk_emails,
    render_email_template
)

from app.utils.security import (
    sanitize_input,
    escape_html,
    prevent_xss,
    prevent_sql_injection,
    generate_csrf_token,
    verify_csrf_token,
    generate_secure_hash,
    encrypt_data,
    decrypt_data,
    validate_file_upload,
    generate_secure_filename,
    check_password_strength,
    log_security_event
)

__all__ = [
    # helpers
    'generate_user_id',
    'format_timestamp', 
    'sanitize_html',
    'validate_email',
    'validate_username',
    'get_file_extension',
    'is_allowed_file',
    'generate_filename',
    'paginate_query',
    'truncate_text',
    'generate_random_string',
    'get_client_ip',
    'format_file_size',
    'parse_bool',
    'safe_int',
    'safe_str',
    'pluck',
    'group_by',
    'relative_time',
    'is_safe_url',
    'generate_gravatar_url',
    'format_number',
    'humanize_list',
    'get_current_year',
    'generate_breadcrumbs',
    'calculate_read_time',
    'generate_excerpt',
    
    # validators
    'PasswordValidator',
    'UsernameValidator', 
    'EmailValidator',
    'ContentValidator',
    'FileValidator',
    
    # exceptions
    'SteHubException',
    'ValidationError',
    'AuthenticationError',
    'AuthorizationError', 
    'ResourceNotFoundError',
    'StorageError',
    'APIError',
    'DatabaseError',
    'NetworkError',
    'ConfigurationError',
    'RateLimitError',
    'FileUploadError',
    'EmailError',
    'ChatError',
    'ForumError',
    'RealTimeError',
    'ThirdPartyServiceError',
    'handle_exception',
    'create_validation_error',
    'create_resource_not_found',
    
    # logging
    'setup_logging',
    'get_logger',
    'log_request',
    'log_response',
    'log_error',
    'log_security_event',
    'log_user_activity',
    'log_database_operation',
    'log_performance_metric',
    'log_decorator',
    
    # cache
    'cache_get',
    'cache_set',
    'cache_delete',
    'cache_clear',
    'cache_get_or_set',
    'cache_memoize',
    'rate_limit',
    'rate_limit_decorator',
    'get_cache_stats',
    'cache_cleanup',
    'generate_cache_key',
    'cache_invalidate',
    
    # email
    'send_email',
    'send_welcome_email',
    'send_password_reset_email',
    'send_notification_email',
    'send_verification_email',
    'send_admin_notification',
    'validate_email_format',
    'send_bulk_emails',
    'render_email_template',
    
    # security
    'sanitize_input',
    'escape_html',
    'prevent_xss',
    'prevent_sql_injection',
    'generate_csrf_token',
    'verify_csrf_token',
    'generate_secure_hash',
    'encrypt_data',
    'decrypt_data',
    'validate_file_upload',
    'generate_secure_filename',
    'check_password_strength',
    'log_security_event'
]